package com.dmw.service.impl;

import com.dmw.dao.DmSchedulerSeatPriceDao;
import com.dmw.entity.DmSchedulerSeatPrice;
import com.dmw.service.DmSchedulerSeatPriceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 节目排期座位价格表(DmSchedulerSeatPrice)表服务实现类
 *
 * @author makejava
 * @since 2021-03-19 00:31:59
 */
@Service("dmSchedulerSeatPriceService")
public class DmSchedulerSeatPriceServiceImpl implements DmSchedulerSeatPriceService {
    @Resource
    private DmSchedulerSeatPriceDao dmSchedulerSeatPriceDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public DmSchedulerSeatPrice queryById(Long id) {
        return this.dmSchedulerSeatPriceDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<DmSchedulerSeatPrice> queryAllByLimit(int offset, int limit) {
        return this.dmSchedulerSeatPriceDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param dmSchedulerSeatPrice 实例对象
     * @return 实例对象
     */
    @Override
    public DmSchedulerSeatPrice insert(DmSchedulerSeatPrice dmSchedulerSeatPrice) {
        this.dmSchedulerSeatPriceDao.insert(dmSchedulerSeatPrice);
        return dmSchedulerSeatPrice;
    }

    /**
     * 修改数据
     *
     * @param dmSchedulerSeatPrice 实例对象
     * @return 实例对象
     */
    @Override
    public DmSchedulerSeatPrice update(DmSchedulerSeatPrice dmSchedulerSeatPrice) {
        this.dmSchedulerSeatPriceDao.update(dmSchedulerSeatPrice);
        return this.queryById(dmSchedulerSeatPrice.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.dmSchedulerSeatPriceDao.deleteById(id) > 0;
    }
}
